var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, a) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var a in t)
              Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
          })(t, a);
      };
      return function (t, a) {
        function i() {
          this.constructor = t;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        e(t, a),
          (t.prototype =
            null === a
              ? Object.create(a)
              : ((i.prototype = a.prototype), new i()));
      };
    })(),
  AXSupplementPhysicalView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.onLoadSuppUserThingDataFn = {
          caller: t,
          code: 1061,
          method: function (e) {
            0 == e.code
              ? (ToastView.toastView(e.data),
                WebSocketService.send({ c: 1416, d: { pageNum: 0 } }),
                WebSocketService.send({ c: 1066, d: null }),
                Laya.stage.event("GameMainView", "exp"),
                Laya.stage.event("HomePageView", "exp"))
              : ToastView.toastView(e.msg);
          },
        }),
        (t.onLoadSupplementPhysicalDataFn = {
          caller: t,
          code: 1066,
          method: function (e) {
            if (0 == e.code) {
              t.dataArr = e.data;
              var a;
              t.dataSource = [];
              for (var i = 0; i < t.dataArr.length; i++)
                1 == t.objRes.type
                  ? ((a = {
                      lable_supply_name: { text: t.dataArr[i].name },
                      lable_supply_number: {
                        text:
                          "血：" + t.dataArr[i].hp + "/" + t.dataArr[i].maxHp,
                      },
                      lable_supply_double_qixue: { text: "" },
                      lable_supply_double_jingli: { text: "" },
                    }),
                    t.dataSource.push(a))
                  : 2 == t.objRes.type
                  ? ((a = {
                      lable_supply_name: { text: t.dataArr[i].name },
                      lable_supply_number: {
                        text:
                          "蓝：" + t.dataArr[i].mp + "/" + t.dataArr[i].maxMp,
                      },
                      lable_supply_double_qixue: { text: "" },
                      lable_supply_double_jingli: { text: "" },
                    }),
                    t.dataSource.push(a))
                  : 3 == t.objRes.type &&
                    ((a = {
                      lable_supply_name: { text: t.dataArr[i].name },
                      lable_supply_number: { text: "" },
                      lable_supply_double_qixue: {
                        text:
                          "血：" + t.dataArr[i].hp + "/" + t.dataArr[i].maxHp,
                      },
                      lable_supply_double_jingli: {
                        text:
                          "蓝：" + t.dataArr[i].mp + "/" + t.dataArr[i].maxMp,
                      },
                    }),
                    t.dataSource.push(a)),
                  (t.list_supplementPhysical.dataSource = t.dataSource);
            }
          },
        }),
        (t.list_supplementPhysical.selectEnable = !0),
        (t.list_supplementPhysical.vScrollBarSkin = ""),
        t.list_supplementPhysical.on(
          Laya.Event.CLICK,
          t,
          t.onSupplyPhysicalDidClickFn
        ),
        t.btn_physicalCancle.on(Laya.Event.CLICK, t, t.close),
        WebSocketService.addListener(t.onLoadSupplementPhysicalDataFn),
        WebSocketService.addListener(t.onLoadSuppUserThingDataFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showPhysicalView = function (e) {
        null == this.physicalView &&
          ((this.physicalView = new t()), (this.physicalView.zOrder = 1e3)),
          this.physicalView.popup(!0),
          (this.physicalView.objRes = e),
          WebSocketService.send({ c: 1066, d: null }),
          (this.physicalView.lbl_supplemnntTitle.text =
            this.physicalView.objRes.name),
          1 == this.physicalView.objRes.type
            ? (this.physicalView.lbl_supplemnntTitle.color = "#f4100d")
            : 2 == this.physicalView.objRes.type &&
              (this.physicalView.lbl_supplemnntTitle.color = "#3b0bfb");
      }),
      (t.prototype.onPhysicalUserThingDidClickFn = function (e) {
        var t = this.objRes.id;
        "item0" == e.target.name
          ? WebSocketService.send({ c: 1061, d: { gid: t, fj: 0, bd: 0 } })
          : "item1" == e.target.name
          ? WebSocketService.send({
              c: 1061,
              d: { gid: t, fj: this.dataArr[1].id, bd: 0 },
            })
          : "item2" == e.target.name
          ? WebSocketService.send({
              c: 1061,
              d: { gid: t, fj: this.dataArr[2].id, bd: 0 },
            })
          : "item3" == e.target.name &&
            WebSocketService.send({
              c: 1061,
              d: { gid: t, fj: this.dataArr[3].id, bd: 0 },
            });
      }),
      (t.prototype.onSupplyPhysicalDidClickFn = function (e) {
        if ("" != e.target.name && "btn_suppy_shiyong" == e.target.name) {
          var t = this.objRes.id,
            a = this.dataArr[this.list_supplementPhysical.selectedIndex].id;
          WebSocketService.send({ c: 1061, d: { gid: t, fj: a, bd: 0 } });
        }
      }),
      (t.close = function () {
        this.physicalView && this.physicalView.close();
      }),
      t
    );
  })(ui.TabBarItemController.AXSupplementPhysicalViewUI);
